<!-- BEGIN NEWS FORM -->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'staffs-form',
	'enableClientValidation'=>false,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'htmlOptions'=>array(
		'class'=>'horizontal-form',
	),
)); ?>
<div class="form-body">
    <div class="row">
        <div class="col-md-6">
            <div class="form-group <?php echo ($model->getError('username') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'username', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'username', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'username', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('email') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'email', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'email', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'email', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('phone') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'phone', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'phone', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'phone', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('role') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'role', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'role', array('A'=>'Quản lý hệ thống', 'M'=>'Quản lý nội dung', 'E'=>'Quản lý bài viết'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'role', array('class'=>'help-block')); ?>
            </div>
        </div>
        <div class="col-md-6">
            <?php if ($model->isNewRecord): ?>
            <div class="form-group <?php echo ($model->getError('password') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'password', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'password', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'password', array('class'=>'help-block')); ?>
            </div>
            <?php else: ?>
            <div class="form-group <?php echo ($model->getError('newPassword') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'newPassword', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'newPassword', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'newPassword', array('class'=>'help-block')); ?>
            </div>
            <?php endif; ?>
            <div class="form-group <?php echo ($model->getError('fullname') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'fullname', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'fullname', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'fullname', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('fullname') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'memberid', array('class'=>'control-label')); ?>
                <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
					'name'=>'member',
                    'value'=>(!empty($model->user->email) ? $model->user->email : ''),
					'source'=>$this->createUrl('/Dashboard/request/suggestMember'),
					'options'=>array(
						'minLength' => '1',
						'showAnim' => 'fold',
						'select' => "js: function(event, data) {
							$('#Staffs_memberid').val(data.item.id);
						}"
					),
					'htmlOptions'=>array(
						'class'=>'form-control'
					),
				)); ?>
                <?php echo $form->hiddenField($model, 'memberid'); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('status') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'status', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'status', array('A'=>'Hoạt động', 'I'=>'Ngừng hoạt động'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'status', array('class'=>'help-block')); ?>
            </div>
        </div>
    </div>
</div>
<div class="form-actions right">
	<button type="reset" class="btn default">Cancel</button>
	<button type="submit" class="btn blue" onClick="Custom.showLoading();"><i class="icon-ok"></i> <?php echo $model->isNewRecord ? 'Tạo mới' : 'Cập nhật thông tin'; ?></button>
</div>
<?php $this->endWidget(); ?>
<!-- END NEWS FORM -->